from selenium import webdriver;
from selenium.webdriver import ActionChains;
import time;

bro = webdriver.Chrome(executable_path="./chromedriver.exe");

bro.get("https://qzone.qq.com/");
time.sleep(1);

# 切换作用域
bro.switch_to.frame("login_frame");
a = bro.find_element_by_id("switcher_plogin");
a.click();

# 模拟账户,密码录入
name_input = bro.find_element_by_id("u");
pwd_input = bro.find_element_by_id("p");
name_input.send_keys("928542835")
pwd_input.send_keys("YPFL-31125");
time.sleep(1);

# 登陆点击
login_btn = bro.find_element_by_id("login_button");
login_btn.click();


time.sleep(1);
# 再次切换作用域
bro.switch_to.frame("tcaptcha_iframe");

# 定位滑块标签
img = bro.find_element_by_id("slideBlock");

# 实例化动作链
action = ActionChains(bro);
action.click_and_hold(img);

action.move_by_offset(170,0).perform();

# 释放动作链
action.release();


